///===============================================
///=  THIS FILE CODES VARIABLES FOR THE 2006-10  =
///=  ISSUES, PID, BELIEF, & BEHAVIOR VARIABLES. =
///=  I THEN RUN ALL OF THE MODELS AND FIGURES.  = 
///=  DATA CLEANED ON 7/05/16 BY PAUL GOREN.     = 
///===============================================
version 13.1
use "c:\GSS\060810gss.dta", clear

/// cases for 2006-2010 = 1276 (see panstat_3)
/// 0 cases missing 2006
/// 724 cases missing 2010


/// =============================
/// = CODING OF ALL VARIABLES.  =
/// =============================
/// panel weights to be used for svy: commands
gen wt123= wtpannr123
fre wt123

/// pid 2006
fre partyid_1
gen pid06=partyid_1
replace pid06=3 if partyid_1==7
replace pid06=pid06/6
replace pid06=.n if partyid_1==.n
label define pid 0 "strd dem" 1 "strg rep" .n "no answer" .i "not in 10"
label value pid06 pid 
fre pid06

/// pid 2010
fre partyid_3
gen pid10=partyid_3
replace pid10=3 if partyid_3==7
replace pid10=pid10/6
replace pid10=.n if partyid_3==.n
replace pid10=.i if partyid_3==.i
label value pid10 pid 
fre pid10


/// relcom 2006
fre pray_1
gen pray06=1-(pray_1-1)/5
replace pray06=.d if pray_1==.d
replace pray06=.n if pray_1==.n
label define pray 0 "never" 1 "several times day" .i "not in 10" .d "DK" .n "NA"
label variable pray06 "how often pray"
label value pray06 pray
fre pray06

fre attend_1
gen attend06=(attend_1/8)
replace attend06=.d if attend_1==.d
label define attend 0 "never" 1 "several times week" .i "not in 10" .d "DK"
label variable attend06 "how often attend church"
label value attend06 attend
fre attend06

fre relactiv_1
gen relact06=(relactiv_1-1)/9
replace relact06=.d if relactiv_1==.d
replace relact06=.n if relactiv_1==.n
label define relact 0 "never" 1 "once a day" .i "not in 10" .d "DK" .n "NA"
label variable relact06 "how much rel actv"
label value relact06 relact
fre relact06

fre god_1
gen god06=(god_1-1)/5
replace god06=.d if god_1==.d
replace god06=.n if god_1==.n
label define god 0 "don't believe" 1 "know HE exists" .i "not in 10"
label variable god06 "how conf god exists?"
label value god06 god
fre god06

///polychoric pray06 attend06 relact06 god06
display (4*.567)/(1+.567*3)
egen relcom06miss=rowmiss(pray06 attend06 relact06 god06)
egen relcom06=rowmean(pray06 attend06 relact06 god06) if relcom06miss<2
label variable relcom06 "rel commitment index"
label define relcom 0 "very weak" 1 "very strong" .i "not in 10"
label value relcom06 relcom
fre relcom06miss relcom06
alpha pray06 attend06 relact06 god06


/// relcom 2010
fre pray_3
gen pray10=1-(pray_3-1)/5
replace pray10=.i if pray_3==.i
replace pray10=.d if pray_3==.d
replace pray10=.n if pray_3==.n
label variable pray10 "how often pray"
label value pray10 pray
fre pray10

fre attend_3
gen attend10=(attend_3/8)
replace attend10=.i if attend_3==.i
replace attend10=.d if attend_3==.d
label variable attend10 "how often attend church"
label value attend10 attend
fre attend10

fre relactiv_3
gen relact10=(relactiv_3-1)/9
replace relact10=.i if relactiv_3==.i
replace relact10=.d if relactiv_3==.d
replace relact10=.n if relactiv_3==.n
label variable relact10 "how much rel actv"
label value relact10 relact
fre relact10

fre god_3
gen god10=(god_3-1)/5
replace god10=.i if god_3==.i
replace god10=.d if god_3==.d
replace god10=.n if god_3==.n
label variable god10 "how conf god exists?"
label value god10 god
fre god10

/// polychoric pray10 attend10 relact10 god10
display (4*.583)/(1+.583*3)
egen relcom10miss=rowmiss(pray10 attend10 relact10 god10)
egen relcom10=rowmean(pray10 attend10 relact10 god10) if relcom10miss<2
label variable relcom10 "rel commitment index"
replace relcom10=.i if pray10==.i
label value relcom10 relcom
fre relcom10miss relcom10


/// orthodox 2006
fre bible_1 
gen orthodox06=bible_1 
recode orthodox06 1=1 2/4=0 .d=.d .n=.n 
label define orthodox 1 "yes" 0 "no" .i "not in 10" .d "DK" .n "NA"
label variable orthodox06 "Bible literal"
label value orthodox06 orthodox
fre orthodox06

/// orthodox 2010
fre bible_3 
gen orthodox10=bible_3 
recode orthodox10 1=1 2/4=0 .d=.d .n=.n 
label variable orthodox10 "Bible literal"
label value orthodox10 orthodox
fre orthodox10


/// moralissues abortion 2006
/// ballot var shows items not on ballot b
fre ballot
tab ballot abany_1, miss
fre abany_1
gen abort1_06=abany_1
recode abort1_06 1=0 2=1 
replace abort1_06=.b if ballot==2 
label variable abort1_06 "abort any reason?"
label define abort 0 "yes" 1 "no" .b "not on ballot b" .i "not in 10"
label value abort1_06 abort
fre abort1_06

fre abdefect_1
gen abort2_06=abdefect_1
recode abort2_06 1=0 2=1  
replace abort2_06=.b if ballot==2 
label variable abort2_06 "abort b defect?"
label value abort2_06 abort
fre abort2_06

fre abhlth_1
gen abort3_06=abhlth_1
recode abort3_06 1=0 2=1  
replace abort3_06=.b if ballot==2 
label variable abort3_06 "abort health?"
label value abort3_06 abort
fre abort3_06

fre abnomore_1
gen abort4_06=abnomore_1
recode abort4_06 1=0 2=1  
replace abort4_06=.b if ballot==2 
label variable abort4_06 "abort no more kids?"
label value abort4_06 abort
fre abort4_06

fre abpoor_1
gen abort5_06=abpoor_1
recode abort5_06 1=0 2=1  
replace abort5_06=.b if ballot==2 
label variable abort5_06 "abort b/c too poor?"
label value abort5_06 abort
fre abort5_06

fre abrape_1
gen abort6_06=abrape_1
recode abort6_06 1=0 2=1 
replace abort6_06=.b if ballot==2 
label variable abort6_06 "abort rape?"
label value abort6_06 abort
fre abort6_06

fre absingle_1
gen abort7_06=absingle_1
recode abort7_06 1=0 2=1 
replace abort7_06=.b if ballot==2 
label variable abort7_06 "abort single??"
label value abort7_06 abort
fre abort7_06

alpha abort1_06 abort2_06 abort3_06 abort4_06 abort5_06 abort6_06 abort7_06, item std
egen abortion06miss=rowmiss(abort1_06 abort2_06 abort3_06 abort4_06 abort5_06 abort6_06 abort7_06)
egen abortion06=rowmean(abort1_06 abort2_06 abort3_06 abort4_06 abort5_06 abort6_06 abort7_06) if abortion06miss<4
replace abortion06=.b if abort1_06==.b
label variable abortion06 "abortion index"
label define abortion 0 "pro-choice" 1 "pro-life" .b "not on ballot b" .i "not in 10"
label value abortion06 abortion
fre abortion06miss abortion06

/// gayrights 2006
fre homosex_1
gen homosex1_06=homosex_1
recode homosex1_06 1=1 2=.666 3=.333 4=0 
replace homosex1_06=.b if ballot==2 
label variable homosex1_06 "homosex rels wrong?"
label define wrong 0 "not wrong at all" 1 "always wrong" .b "not on ballot b" .i "not in 10"
label value homosex1_06 wrong
fre homosex1_06

fre marhomo_1
gen homosex2_06=marhomo_1
recode homosex2_06 1=0 2=.25 3=.5 4=.75 5=1 
replace homosex2_06=.b if ballot==2 
label variable homosex2_06 "homosex have right to marry"
label define disagree 0 "strg agree" 1 "strg disagree" .b "not on ballot b" .i "not in 10"
label value homosex2_06 disagree
fre homosex2_06

/// polychoric homosex1_06 homosex2_06
display (2*.800)/(1+.800*1)
gen homosex06=(homosex1_06+homosex2_06)/2
label variable homosex06 "supp gay rights"
replace homosex06=.b if homosex_1==.i
label define support 0 "support" 1 "oppose" .b "not on ballot b" .i "not in 10"
label value homosex06 support
fre homosex06

/// polychoric homosex1_06 homosex2_06  abort1_06 abort2_06 abort3_06 abort4_06 abort5_06 abort6_06 abort7_06
display (9*.737)/(1+.737*8)
gen moralissues06=(abortion06+homosex06)/2
label variable moralissues06 "moralissues index"
label define moralissues 0 "liberal" 1 "cons" .b "not on ballot b" .i "not in 10"
replace moralissues06=.b if homosex_1==.i
label value moralissues06 moralissues
fre moralissues06


/// moralissues: abortion 2010
fre abany_3
gen abort1_10=abany_3
recode abort1_10 1=0 2=1 
replace abort1_10=.b if ballot==2
label variable abort1_10 "abort any reason?"
label value abort1_10 abort
fre abort1_10

fre abdefect_3
gen abort2_10=abdefect_3
recode abort2_10 1=0 2=1 
replace abort2_10=.b if ballot==2 
label variable abort2_10 "abort b defect?"
label value abort2_10 abort
fre abort2_10

fre abhlth_3
gen abort3_10=abhlth_3
recode abort3_10 1=0 2=1 
replace abort3_10=.b if ballot==2
label variable abort3_10 "abort health?"
label value abort3_10 abort
fre abort3_10

fre abnomore_3
gen abort4_10=abnomore_3
recode abort4_10 1=0 2=1 
replace abort4_10=.b if ballot==2
label variable abort4_10 "abort no more kids?"
label value abort4_10 abort
fre abort4_10

fre abpoor_3
gen abort5_10=abpoor_3
recode abort5_10 1=0 2=1 
replace abort5_10=.b if ballot==2
label variable abort5_10 "abort b/c too poor?"
label value abort5_10 abort
fre abort5_10

fre abrape_3
gen abort6_10=abrape_3
recode abort6_10 1=0 2=1  
replace abort6_10=.b if ballot==2
label variable abort6_10 "abort rape?"
label value abort6_10 abort
fre abort6_10

fre absingle_3
gen abort7_10=absingle_3
recode abort7_10 1=0 2=1  
replace abort7_10=.b if ballot==2
label variable abort7_10 "abort single??"
label value abort7_10 abort
fre abort7_10

alpha abort1_10 abort2_10 abort3_10 abort4_10 abort5_10 abort6_10 abort7_10, item std
egen abortion10miss=rowmiss(abort1_10 abort2_10 abort3_10 abort4_10 abort5_10 abort6_10 abort7_10)
egen abortion10=rowmean(abort1_10 abort2_10 abort3_10 abort4_10 abort5_10 abort6_10 abort7_10) if abortion10miss<4
replace abortion10=.b if abort1_10==.b
replace abortion10=.i if abort1_10==.i
label variable abortion10 "abortion index"
label value abortion10 abortion
fre abortion10miss abortion10


/// gayrights 2010
fre homosex_3
gen homosex1_10=homosex_3
recode homosex1_10 1=1 2=.666 3=.333 4=0 
replace homosex1_10=.b if ballot==2
replace homosex1_10=.i if homosex1_10==.i
label variable homosex1_10 "homosex rels wrong?"
label value homosex1_10 wrong
fre homosex1_10

fre marhomo_3
gen homosex2_10=marhomo_3
recode homosex2_10 1=0 2=.25 3=.5 4=.75 5=1 
replace homosex2_10=.b if ballot==2
replace homosex2_10=.i if homosex2_10==.i
label variable homosex2_10 "homosex have right to marry"
label value homosex2_10 disagree
fre homosex2_10

/// polychoric homosex1_10 homosex2_10
display (2*.774)/(1+.774*1)
gen homosex10=(homosex1_10+homosex2_10)/2
label variable homosex10 "supp gay rights"
replace homosex10=.i if homosex_3==.i
replace homosex10=.b if ballot==2
label value homosex10 support
fre homosex10

/// polychoric homosex1_10 homosex2_10  abort1_10 abort2_10 abort3_10 abort4_10 abort5_10 abort6_10 abort7_10
display (9*.730)/(1+.730*8)
gen moralissues10=(abortion10+homosex10)/2
label variable moralissues10 "moralissues index"
replace moralissues10=.i if homosex_3==.i
replace moralissues10=.b if ballot==2
label value moralissues10 moralissues
fre moralissues10


/// controls
/// black
fre race_1
gen black=race_1
recode black 1=0 2=1 3=0  
label variable black "black dummy"
label define black 1 "black" 0 "non-black" 
label value black black
fre black

/// age
fre age_1
gen age=age_1
replace age=. if age_1==99
fre age

/// female
fre sex_1
gen female=sex_1
recode female 1=0 2=1
fre female

/// college
fre degree_1
gen college=degree_1
recode college 0/2=0 3/4=1 
label variable college "college grad?"
label define yes 0 "no" 1 "yes" 
label value college yes
fre college



/// ===================================
/// = TABLE 1: STABILITY ESTIMATES.   =  
/// ===================================
svyset vpsu [pw=wt123], strata(vstrata) singleunit(certainty)
regress moralissues10 moralissues06 [pw=wt123], cformat(%4.2f) beta
regress pid10 pid06 [pw=wt123], cformat(%4.2f) beta
regress orthodox10 orthodox06 [pw=wt123], cformat(%4.2f) beta
regress relcom10 relcom06 [pw=wt123], cformat(%4.2f) beta


/// =======================================================
/// = FIGURE 1 & TABLE C: DV = PID10, IV = MORALISSUES06. =  
/// ======================================================= 
svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(moralissues06=(0(.1)1) orthodox06=1 female=1 black=0 college=0)
marginsplot, ///
  name(pid0610, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) ///
  xtitle("2006 Culture War Position", size(medlarge) margin(zero)) ///
  xlabel(0 "Progressive" .99 "Orthodox", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Party ID", size(medlarge) margin(zero)) ///
  ylabel(0 "Strg Dem" .50 "Indp" 1 "Strg Rep", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  ///
  text(.11 .95 "b = 0.11", size(medium)) ///
  text(.04 .95 "{it:t} = 3.17", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))
  
graph save pid0610 "C:\Graphs\pid0610.gph", replace
  
 
/// ======================================================
/// = FIGURE 2 & TABLE C: DV = MORALISSES10, IV = PID06. =  
/// ====================================================== 
svy: regress moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(pid06=(0(.1)1) orthodox06=1 female=1 black=0 college=0)
marginsplot, ///
  name(cw0610p, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) ///
  xtitle("2006 Party ID", size(medlarge) margin(zero)) ///
  xlabel(0 "Strg Dem" .98 "Strg Rep", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Culture War Position", size(medlarge) margin(zero)) ///
  ylabel(0 "Prog" 1 "Ortho", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  ///
  text(.11 .95 "b = 0.04", size(medium)) ///
  text(.04 .95 "{it:t} = 1.41", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))   

graph save cw0610p "C:\Graphs\cw0610p.gph", replace

  
/// ===========================================================
/// = FIGURE 3 & TABLE C: DV = ORTHODOX10, IV = MORALISSUES06 =  
/// =========================================================== 
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(moralissues06=(0(.1)1) orthodox=1 female=1 black=0 college=0)
marginsplot, ///
  name(ortho0610, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) ///
  xtitle("2006 Culture War Position", size(medlarge) margin(zero)) ///
  xlabel(0 "Progressive" .99 "Orthodox", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Bible Word of God?", size(medlarge) margin(zero)) ///
  ylabel(0 "P(no)" 1 "P(yes)", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  ///
  text(.11 .95 "b = 1.03", size(medium)) ///
  text(.04 .95 "{it:t} = 2.60", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))   

graph save ortho0610 "C:\Graphs\ortho0610.gph", replace
  
  
/// ============================================================
/// = FIGURE 4 & TABLE C: DV = MORALISSUES10, IV = ORTHODOX06  =  
/// ============================================================ 
svy: regress moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(orthodox06=(0(1)1) female=1 black=0 college=0)
marginsplot, ///
  name(cw0610o, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) ///
  xtitle("2006 Bible Word of God?", size(medlarge) margin(zero)) ///
  xlabel(0 "No" .98 "Yes", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Culture War Position", size(medlarge) margin(zero)) ///
  ylabel(0 "Prog" 1 "Ortho", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  /// 
  text(.11 .95 "b = 0.05", size(medium)) ///
  text(.04 .95 "{it:t} = 2.92", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))

graph save cw0610o "C:\Graphs\cw0610o.gph", replace
  
  
/// ==========================================================
/// = FIGURE 5 & TABLE C: DV = RELCOM10, IV = MORALISSUES06. =  
/// ========================================================== 
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(moralissues06=(0(.1)1) orthodox06=1 female=1 black=0 college=0)
marginsplot, ///
  name(relcom0610, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) ///
  xtitle("2006 Culture War Position", size(medlarge) margin(zero)) ///
  xlabel(0 "Progressive" .99 "Orthodox", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Religious Commitment", size(medlarge) margin(zero)) ///
  ylabel(0 "Weak" 1 "Strong", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  ///
  text(.11 .95 "b = 0.08", size(medium)) ///
  text(.04 .95 "{it:t} = 4.12", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))

graph save relcom0610 "C:\Graphs\relcom0610.gph", replace
  
  
/// ==========================================================
/// = FIGURE 6 & TABLE C: DV = MORALISSUES10, IV = RELCOM06  =  
/// ==========================================================   
svy: regress moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
margins, at(relcom06=(0(.1)1) orthodox06=1 female=1 black=0 college=0)
marginsplot, ///
  name(cw0610r, replace) ///
  plotopts(mcolor(black)) ciopts(lcolor(black)) ///
  title(2006-10 GSS, size(large) ring(0)) ///
  xsize(5) /// 
  xtitle("2006 Religious Commitment", size(medlarge) margin(zero)) ///
  xlabel(0 "Weak" .98 "Strong", noticks labsize(medium)) ///
  ysize(5) ///
  ytitle("2010 Culture War Position", size(medlarge) margin(zero)) ///
  ylabel(0 "Prog" 1 "Ortho", noticks labsize(medium) angle(0)) ///
  yline(.50, lpattern(shortdash))  ///
  text(.11 .95 "b = 0.10", size(medium)) ///
  text(.04 .95 "{it:t} = 2.98", size(medium)) ///
  scheme(s1mono) ///
  scale(.5) aspectratio(1) ///
  plotregion(lcolor(white))

graph save cw0610r "C:\Graphs\cw0610r.gph", replace  


/// ==============================================
/// = SUPPLEMENTAL MATERIALS: ON-LINE APPENDICES =  
/// ==============================================

/// =====================================================
/// = TABLE A: DESCRIPTIVE STATISTICS FOR KEY VARIABLES =  
/// =====================================================
summ moralissues06 pid06 orthodox06 relcom06
summ moralissues10 pid10 orthodox10 relcom10


/// =============================
/// = FIGURE A: Kernal Desnity  =  
/// =============================    
twoway(kdensity moralissues06, lcolor(red) lwidth(medium) kernel(gaussian) bwidth(.075)) /// 
 (kdensity moralissues10, lcolor(blue) lwidth(medium) kernel(gaussian) bwidth(.075) ), ///
 name(cw0610density, replace) ///
 title("2006-10 GSS", size(medsmall) ring(0)) ///
 ytitle("Density", size(medsmall) margin(zero)) ///
 ylabel(.00 " " 1.5 " ", labsize(small) angle(zero) tstyle(major_notick)) ///
 xlabel(0 "Progressive" .97 "Orthodox", labsize(small) tstyle(major_notick)) ///
 xtitle("Position on Culture War Issues", size(medsmall) margin(zero)) ///
 legend(on order(1 "2006" 2 "2010") cols(2) ring(0)) ///
 plotregion(lcolor(white)) ///
 scheme(s1mono)

graph save cw0610density "C:\Graphs\cw0610density.gph", replace



/// ================================================================
/// = TABLE H ROBUSTNESS CHECK: ABORTION & GAY RIGHTS ON PARTY ID  =  
/// ================================================================
/// 2 items used to measure gay rights
/// 7 item used to measure abortion 

svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: regress pid10 abortion06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)  
svy: regress pid10 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: regress pid10 abortion06 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)


/// ===============================================================
/// = TABLE I ROBUSTNESS CHECK: ABORTION & GAY RIGHTS ON ORTHODOX =  
/// ===============================================================
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: logit orthodox10 abortion06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)  
svy: logit orthodox10 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: logit orthodox10 abortion06 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)


/// =============================================================
/// = TABLE J ROBUSTNESS CHECK: ABORTION & GAY RIGHTS ON RELCOM =  
/// ==============================================================
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: regress relcom10 abortion06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)  
svy: regress relcom10 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f) 
svy: regress relcom10 abortion06 homosex06 pid06 orthodox06 relcom06 age female black college, cformat(%4.2f)


/// ============================================================
/// = TABLE M ROBUSTNESS CHECK: SYMBOLIC IDEOLOGY ON ALL 4 DVS =  
/// ============================================================
/// ideo: based on 7-pt scale 
fre polviews_1
gen ideo06=polviews_1
replace ideo06=(ideo06-1)/6
label variable ideo06 "Ideo ID"
label define ideo06 0 "ext lib" 1 "ext con"
label value ideo06 ideo06
fre ideo06

svy: regress moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college ideo06, cformat(%4.2f)
svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college ideo06, cformat(%4.2f)
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college ideo06, cformat(%4.2f)
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college ideo06, cformat(%4.2f)


/// ===========================================================
/// = TABLE O ROBUSTNESS CHECK: AUTHORITARIANISM ON ALL 4 DVS =  
/// ===========================================================
/// use the 2 child rearing items: ranking of obey and think for ones self
fre obey_1
gen obey06=obey_1
recode obey06 1=1 2=.75 3=.5 4=.25 5=0
label variable obey06 "rank importance child obey"
label define import 0 "least imp" 1 "most imp"
label value obey06 import
fre obey06

fre thnkself_1
gen thnkself06=thnkself_1
recode thnkself06 1=1 2=.75 3=.5 4=.25 5=0
label variable thnkself06 "think for oneself"
label value thnkself06 import
fre thnkself06

gen auth06=(obey06-thnkself06+1)/2
label variable auth06 "authorianism"
label define auth 0 "non-auth" 1 "auth"
label value auth06 auth
fre auth06

svy: regress moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college auth06, cformat(%4.2f)
svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college auth06, cformat(%4.2f)
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college auth06, cformat(%4.2f)
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college auth06, cformat(%4.2f)


/// ===========================================
/// = TABLE R ROBUSTNESS CHECK: INTERACTIONS  =  
/// ===========================================
/// age
gen moral_age=moralissues06*age

svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_age, cformat(%4.2f) 
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_age, cformat(%4.2f) 
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_age, cformat(%4.2f) 

/// pid
gen moral_pid=moralissues06*pid06
svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_pid, cformat(%4.2f) 
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_pid, cformat(%4.2f) 
svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college moral_pid, cformat(%4.2f) 

/// education
svy: regress pid10 moralissues06 pid06 orthodox06 relcom06 age female black  ///
  i.college i.college#c.moralissues06   
  
svy: logit orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black  ///
  i.college i.college#c.moralissues06  

svy: regress relcom10 moralissues06 pid06 orthodox06 relcom06 age female black  ///
  i.college i.college#c.moralissues06 


/// =============================================
/// = TABLE V ROBUSTNESS CHECK: EIV REGRESSION =  
/// =============================================
/// we use ordinal alpha reliability estimates for ordinal level indicators 
/// these estimates are constrained so that stability point estimate <= .90
/// otherwise, EIV results can suggest lagged variables are perfectly stable
/// doesn't square with evidence of substantial macro-level liberalization in periods too short to be accounted for by cohort replacement
/// addresses criticisms raised by Converse, Luskin, Zaller about measurement (over)adjustments that artifactually enahnce stability
/// pid estimates comes from Chen and Goren (2016) estimates in PRQ paper (3-wave Wiley-Wiley models)
/// use OLS for dichotomous orthodox measure
eivreg moralissues10 moralissues06 pid06 orthodox06 relcom06 age female black college, reliab(pid06 .894 moralissues06 .96 relcom06 .84)
eivreg pid10 moralissues06 pid06 orthodox06 relcom06 age female black college, reliab(pid06 .894 moralissues06 .96 relcom06 .84)
eivreg orthodox10 moralissues06 pid06 orthodox06 relcom06 age female black college, reliab(pid06 .894 moralissues06 .96 relcom06 .84)
eivreg relcom10 moralissues06 pid06 orthodox06 relcom06 age female black college, reliab(pid06 .894 moralissues06 .96 relcom06 .89)


/// ===========================================
/// = TABLE Z ROBUSTNESS CHECK: IV REGRESSION =  
/// ===========================================
/// we use 2SLS for moral issues, pid, and relcom models
/// we use ivprobit for orthodox model

/// 2SLS: pid 
svy: ivregress 2sls moralissues10 moralissues06 orthodox06 relcom06 age female black college (pid10 = pid06), cformat(%4.2f) 
svy: ivregress 2sls pid10 pid06  orthodox06 relcom06 age female black college (moralissues10= moralissues06), cformat(%4.2f) 

/// 2SLS: orthodox
svy: ivregress 2sls moralissues10 pid06 moralissues06 relcom06 age female black college (orthodox10 = orthodox06), cformat(%4.2f) 
svy: ivprobit orthodox10 pid06 orthodox06 relcom06 age female black college (moralissues10 = moralissues06), cformat(%4.2f) 

/// 2SLS: relcom
svy: ivregress 2sls moralissues10 pid06 moralissues06 orthodox06 age female black college (relcom10 = relcom06), cformat(%4.2f)
svy: ivregress 2sls relcom10 pid06 orthodox06 relcom06 age female black college (moralissues10 = moralissues06), cformat(%4.2f)

 
/// ============================================================
/// = TABLE DD & EE: SELECTION AND ENDOGENOUS TREATMENT MODELS =  
/// ============================================================
/// recode moralissues into binary treatment variable
/// first recode drops scale midpoint
/// second recode drops .40-.60 scale
/// then code variables used to predict treatment assignment
/// then recode orthodox into 3 point scale to better approximate normality assumption for method
tab moralissues06
clonevar treat06=moralissues06
recode treat06 0/.499=0 .500011/1=1 .4999/.5=.
label define treat 0 "untreated=prog" 1 "treated=trad" 
label value treat06 treat
fre treat06

tab moralissues06
clonevar treat06r=moralissues06
recode treat06r 0/.3999=0 .600001/1=1 .4/.6=.
label value treat06r treat
fre treat06r

fre marital_1
clonevar married=marital_1
recode married 11=1 2/5=0
label define married 0 "other" 1 "married" 
label value married married
fre married

fre babies_1 preteen_1 teens_1
gen numkids=babies_1+preteen_1+teens_1
fre numkids

fre region_1
gen south=region_1
recode south 1/4=0 5/7=1 8/9=0
label define south 0 "other" 1 "south" 
label value south south
fre south

fre reg16_1
gen south16=reg16_1
recode south16 1/4=0 5/7=1 8/9=0
label value south16 south
fre south16

fre relig16_1
gen secular16=relig16_1
recode secular16 1/3=0 4=1 5/12=0
label define sec 0 "rel id" 1 "none" 
label value secular16 sec
fre secular16


fre bible_1 
gen orthodox06c=bible_1 
recode orthodox06c 1=1 2=.5 3=0 4=. .d=.d .n=.n 
label variable orthodox06c "Bible literal"
label value orthodox06c orthodox
fre orthodox06c

fre bible_3 
gen orthodox10c=bible_3 
recode orthodox10c 1=1 2=.5 3=0 4=. .d=.d .n=.n
label variable orthodox10c "Bible literal"
label value orthodox10c orthodox
fre orthodox10c


/// first do probit model to assess fit of treatment assignment equation
/// treament modeled as function of who you are, where you were raised, how you were raised
/// childs_1 is # of kids people have had, different from # kids in household under 18
svy: probit treat06 age college married numkids childs_1 south south16 secular16, cformat(%4.2f)
probit treat06 age college married numkids childs_1 south south16 secular16 [pweight = wt123], cformat(%4.2f)
fitstat
estimates store selection1

svy: probit treat06r age college married numkids childs_1 south south16 secular16, cformat(%4.2f)
probit treat06r age college married numkids childs_1 south south16 secular16 [pweight = wt123], cformat(%4.2f)
fitstat
estimates store selection2

esttab selection1 selection2, b(%6.2f) t ar2 ///
  title(Treatment Selection Model ) ///
  nonumbers mtitles("Measure 1" "Measure 2") ///
  addnote("Source: 2006-10 GSS") 


/// pid
etregress pid10 pid06 age female black college [pweight = wt123], /// 
  treat(treat06 = age college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model1

etregress pid10 pid06 age female black college [pweight = wt123], /// 
  treat(treat06r = age college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model2

/// orthodox
etregress orthodox10c orthodox06c age female black college [pweight = wt123], /// 
  treat(treat06 = age college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model3

etregress orthodox10c orthodox06c age female black college [pweight = wt123], /// 
  treat(treat06r = age college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model4

/// relcom
etregress relcom10 relcom06 age female black college [pweight = wt123], /// 
  treat(treat06 = age college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model5

etregress relcom10 relcom06 age female black college [pweight = wt123], /// 
  treat(treat06r = age  college married numkids childs_1 south south16 secular16) cformat(%4.2f)
estimates store model6


/// summarize in table
esttab model1 model2 model3 model4 model5 model6, b(%6.2f) se ar2 ///
  title(Endogenous Treatment models: Moral Issues ATE) ///
  nonumbers mtitles("PID T1" "PID T2" "Bible T1" "Bible T2" "Rel T1" "Rel T2") ///
  addnote("Source: 2006-10 GSS") 


